let oSavebtn1 = document.querySelector('.saveBtn1');
let oInp1 = document.querySelector('.inp1');
let oSp4 = document.querySelector('.span4');
let oSp5 = document.querySelector('.span5');
let oInp2 = document.querySelector('.inp2');
let oSp6 = document.querySelector('.spn6');
let aTels = document.querySelector('.telS');
let oSavebtn2 = document.querySelector('.saveBtn2');
let oSp7 = document.querySelector('.span7');
let oSavebtn3 = document.querySelector('.save-btn3');
let oInp3 = document.querySelector('.inp3');
let oSp8 = document.querySelector('.span8');
let oInpname=document.querySelector('.inp-name');
let oInpbrith=document.querySelector('.inp-brithday');
let oSavebtn4 = document.querySelector('.save-btn4');
let aSpan=document.querySelector('.gl_spa1');

let reg = {
    tel: {
        con: /^1[3-9]\d{9}$/,
        error: '您输入的电话号码有误'
    },
    pass: {
        con: /^(?=.*[A-Z])(?=.*[!@#$%&*])(?=.*\d).{8,12}$/,
        error: '密码必须包含大写字母数字和特殊符号'
    },
    qq: {
        con: /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/,
        error: '请输入正确的qq号'
    }
}
    let mbArr=[];

oSavebtn1.addEventListener('click', function () {
    verif();
});
oSavebtn2.addEventListener('click', function () {
    verif2();
});
oSavebtn3.addEventListener('click', function () {
    verif3();
});
function verif() {
    oInp1.addEventListener('blur', function () {
        let str1 = oInp1.value.trim();
        if (str1 == '') {
            this.parentNode.className = 'error';
            oSp5.innerText = '内容不能为空！'
            oSp5.style.color = 'red'
            return;
        }
        if (reg.pass.con.test(str1) == false) {
            console.log(reg.pass.con.test(str1))
            oSp4.innerHTML = '差';
            oSp4.style.color = 'red';
            oSp5.innerHTML='';
            return;
        } else {
            oSp4.innerHTML = '强';
            oSp4.style.color = 'green';
            oSp5.innerHTML='';
        }
    });
}
verif();

function verif2() {
    oInp2.value = aTels.innerHTML;
    oInp2.addEventListener('blur', function () {
        let str2 = oInp2.value.trim();
        if (str2 == '') {
            this.parentNode.className = 'error';
            oSp6.innerText = '内容不能为空！'
            oSp6.style.color = 'red'
            return;
        }
        if (reg.tel.con.test(str2) == false) {
            // console.log(reg.tel.con.test(str2))
            oSp6.innerHTML='手机号错误';
            oSp6.style.color = 'red'
        } else {
            let ph = oInp2.value
            ph = ph.slice(0, 3) + '****' + ph.slice(ph.length - 4);
            aTels.innerText = ph;
        }

    });
}
verif2();
function verif3() {
    oInp3.value = oSp8.innerHTML;
    oInp3.addEventListener('blur', function () {
        let str3 = oInp3.value.trim();
        if (str3 == '') {
            this.parentNode.className = 'error';
            oSp7.innerText = '内容不能为空！'
            oSp7.style.color = 'red'
            return;
        }
        if (reg.qq.con.test(str3) == false) {
            // console.log(reg.tel.con.test(str3))
            oSp7.innerText=''
        } else {
            oSp8.innerHTML = oInp3.value;
            oSp7.innerText='';
        }

    });
}
verif3();
oSavebtn4.addEventListener('click',function(){
    aSpan.innerHTML='设置成功'
    verif4();
    
})
function verif4(){
    oInpname.value .push(mbArr) ;
    oInpbrith.value.push(mbArr);
}
verif4();

